<template>
  <div id="m3heade">
    <div class="m3main">
        <div class="m3bank1">
            <router-link to="Transfer"><img src="../assets/img/jiantou.png" alt=""> </router-link>
            <h1>手机号转账</h1>
        </div>
        <div class="m3bank">
            <div class="m3bank-1">
                <span>收款手机号</span>
                <input class="m3bank-11" v-model="m3shou" type="text" placeholder="            请输入手机号">
            </div>
            <div class="m3bank-2">
                <span> 收款人</span>
               <input class="m3bank-22"  v-model="m3bankkk" type="text" placeholder="              请输入真实姓名">
            </div>
        </div>
        <div class="m3ww">温馨提示</div>
        <div>1.请您从通讯录选择收款人正确手机号。</div>

        <div>2.请务必确认收款人姓名，手机号真实有效。</div>

        <div>3.如未在收款行设置手机号收款，则无法使用本功能对其转账。</div>
         <div class="m3bank2-2" @click="bank" >下一步</div>
        
        
    </div>
  </div>
</template>

<script>
import { Dialog } from "vant";
import {tr} from "../api/TransferA"
export default {
         data(){
            return{
                m3shou:"",
                m3bankkk:"",
               
            }
         },
         methods:{
            bank(){
              let admin = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/
              if(admin.test(this.m3shou)){
                console.log(77777);
                let tran={phone:this.m3shou, name:this.m3bankkk}
                tr(tran).then((res)=>{
                  if(res.code==200){
                    console.log(res);
                    this.$router.push({
                    name:"Transfer2",
                    params:{
                        skr:this.m3bankkk,
                        data:res.data
                    }
                })
                  }else{
                    Dialog({ title: "温馨提示", message: res.msg });
                  }
                })
            }else if( this.m3shou != admin && this.m3bankkk== ""){
              Dialog({ title: "温馨提示", message: "手机号或名字不能为空，请重新输入" });
            }else if(this.m3shou != admin){
              Dialog({ title: "温馨提示", message: "请输入正确的手机号" });
            }
         }
              }
               
}
</script>

<style scoped src="../assets/css/transfer accounts.css" >

</style>